package com.example.xftest.controller;

import com.example.xftest.entity.User;
import com.example.xftest.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Controller
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/select")
    public List<User> select() {
        return userService.select();
    }

    @RequestMapping("/add")
    public int add(User user) {
        return userService.add(user);
    }

    @RequestMapping("/delete")
    public int delete( int id) {
        return userService.delete(id);
    }

    @RequestMapping("/update")
    public int update(User user) {
        return userService.update(user);
    }
}